Perpendicular to a Line at a Point

If we have the slope, $m$, of a line, $y=mx+b,$ then the slope of the perpendicular line is $-1/m.$ If we have a 2-dimensional direction vector given as $\binom{a}{b},$ then the orthogonal direction vector in a clockwise rotation is given by $\binom{b}{-a}.$ Now if we have coordinates $(x_{1},y_{1})$ for a point whether the point is on the line or not on the line, then the perpendicular line equation which passes through point $(x_{1},y_{1})$ in point slope form will be $$y-y_{1}=\left(-\frac{1}{m}\right)\left(x-x_{1}\right).$$

graph of perp line
Shows a perpendicular to a line at a point. Whether you imagine the original line to be the green or the red, notice that the other one has a slope of $-1/m$.
 
Example: Given the line $y=3x/2+3,$ find a line that is perpendicular and passes through the point $(4,15).$ Answer: The slope of the new line is -2/3. Plugging in the point $(4,15)$ the equation is $(y-15)=(-2/3)(x-4).$ Solving for $y$, the new equation for the perpendicular is $$y=-\frac{2}{3}x+\left(15+\frac{8}{3}\right).$$

Equation of line between two points

Using the slope intercept equation of a line is one way to obtain a line equation from two points. In 2-dimensions, it works satisfactorily as long as the line isn't vertical. If it is vertical, we might just know that the equation is $x=constant$. Once the slope is found, then we can substitute in either point, $P$ or $Q$ and solve for the intercept. $$Slope=\frac{Q_{y}-P_{y}}{Q_{x}-P_{x}}\qquad Intercept=P_{y}-Slope\cdot P_{x}$$ Slope is defined as $rise/run$. Then using the point $P$, the intercept is calculated. The line equation is $y(x)=slope\cdot x+intercept$. Figure aa shows an example of finding a line equation from two points.

Slope_Intercept_Line.png
Slope Intercept Equation Derived from 2 points. Slope is obtained as rise over run and b is obtained by algebra after substituting actual values for $P_{y}$ and $P_{x}$. In the figure $P=(4,6)$ and $Q=(2,2)$. The line equation becomes $y=2x-2$. For a live applet: https://www.geogebra.org/m/F8vVnDvX
 

Tangent Line to a Curve

Sometimes we want to graph a line that is tangent to some curve at some particular point. Suppose I have the curve, $f(x)=(9-x)\cdot x^{2}$. The slope of the tangent line is just the first derivative of the equation: $f'(x)=-3x^{2}+18x$. Using the point slope form for a line, $y(x)-f(x_{1})=f'(x_{1})\cdot(x-x_{1})$. The known point is $[x_{1},\;f(x_{1})]$. If the equation is solved, $y(x)$ will be a line $$y(x)=f'(x_{1})x-f'(x_{1})x_{1}+f(x_{1})$$ which is tangent to the known point on the curve. Suppose that $x_{1}=a$ then the equation becomes $$y=f'(a)\cdot(x-a)+f(a). \tag{EQ 1}\label{EQ 1}$$

Equation $\eqref{EQ 1}$ represents the equation of a line that is tangent to the curve, $f(x)$, at some $x$ value $x=a.$

Tangent Line Less Calculus

There are a few curves, the circle, a parabola, and maybe no others, where the tangent line to the curve at a given point can be found purely by geometry. Those are exceptions. Finding the tangent to a curve at a particular point on the curve is one of the classic problems of math before the invention of calculus. We are going to do it here by a method that is almost calculus, but avoids using the word derivative. The argument presented is tedious. It is easier to memorize a power rule for differentiation and use the calculus.

Example: Find a tangent line to the curve $f(x)=3x^{2}-x^{3}$ at the point $A=\left(\sqrt{3}+1,\,2\right)$. In figure [Tangent Line by Limits], I have shown the curve along with point $A$ which is graphed on the curve. I have also shown the curve in the vicinity of $A$ but with the $x$ scale expanded to better show the curvature about $A$.
Tangent by Limits.png
Tangent Line by Limits: The left graphic shows curve $f(x)=3x^{2}-x^{3}$ with point $A$ having coordinates $A=\left(\sqrt{3}+1,\,2\right)$. The right graphic is point $A$ with the $x$ scale greatly expanded so as to show that there is curvature in the vicinity of the point.
 
Answer:

The slope of our tangent line, will be called $m$. The tangent is a line that touches $A$ but otherwise does not intersect $f(x)$. We know that the slope is defined as $\Delta y/ \Delta x$ but we only have one point. Since we know the equation of the curve, we can find a second point in the vicinity, which will permit estimating the slope at $A$. We will call the new point $B$ and calculate it at $x=2.9$ which we can see from figure [Tangent by Limits] is to the right of $A$. From $f(x)=3x^{2}-x^{3}$ we can calculate that $B=\left(2.9,\,0.841\right)$.

Now that we have two points, $A$ and $B$, we can estimate a slope. $$\text{Estimate of m}=\frac{A_{y}-B_{y}}{A_{x}-B_{x}}=\frac{\left(2-0.841\right)}{\left(\sqrt{3}+1-2.9\right)}=-6.9$$

This is good, but we could get a better estimate if we moved point $B$ closer to $A$. So let's choose $x=2.8$ and do it again. $B=(2.8,\,1.568)$. $$\text{Estimate of m}=\frac{A_{y}-B_{y}}{A_{x}-B_{x}}=\frac{\left(2-1.568\right)}{\left(\sqrt{3}+1-2.8\right)}=-6.358$$

Indeed, we can keep moving point $B$ closer and closer to $A$ and continue to improve our estimate. Let's create a little table where we show the $x$ value as $B_{x}$ and then we show the distance away from $A$ as $\Delta x=A_{x}-B_{x}$ and finally, the slope estimate, $m(Est)$. In this table, the target, $A_{x}=2.7320508=\sqrt{3}+1$

$$\begin{array}{ccc} B_{x} & \Delta x & m(Est.)\\ 2.800000000 & -0.06794919244 & -6.357691453\\ 2.790487113 & -0.05843630549 & -6.307058751\\ 2.780974226 & -0.04892341855 & -6.256607042\\ 2.771461339 & -0.03941053161 & -6.206336316\\ 2.761948452 & -0.02989764467 & -6.156246587\\ 2.752435565 & -0.02038475774 & -6.106337836\\ 2.742922678 & -0.01087187079 & -6.056610088\\ 2.733409791 & -0.001358983849 & -6.007063451 \end{array}$$ From the table, it appears that the closer we choose $B$ to $A$ the more likely it is that the line intersects at $A$ and only $A$. That should be obvious. That also means that what we want is to find the limit of $\Delta y/\Delta x$ as $\Delta x$ approaches zero. $$m=\lim_{\Delta x\rightarrow0}\frac{\Delta y}{\Delta x}$$ The way we have been going about this is to create point $B$ where $B$ is a tiny amount, $\Delta x$ to the right of point $A$. Since $\Delta x=\left(B_{x}-A_{x}\right)$, that can be written as $$m=\lim_{\Delta x\rightarrow0}\frac{f(A_{x}+\Delta x)-f(A_{x})}{\Delta x}$$ In order to find this limit, we can replace $\Delta x$ with $h$. $$m=\lim_{h\rightarrow0}\frac{f(A_{x}+h)-f(A_{x})}{h}$$ and then we can use the actual function $f(x)=3x^{2}-x^{3}$ in the expression. $$m=\lim_{h\rightarrow0}\frac{3(x+h)^{2}-(x+h)^{3}-\left[3(x)^{2}-x^{3}\right]}{h}$$ Expanding $$m=\lim_{h\rightarrow0}\frac{3x^{2}+6hx+3h^{2}-\left[x^{3}+3hx^{2}+3h^{2}x+h^{3}\right]-\left[3(x)^{2}-x^{3}\right]}{h}$$ Notice that we can cancel the $3x^{2}$ and $x^{3}$ terms. $$m=\lim_{h\rightarrow0}\frac{6hx+3h^{2}-\left[3hx^{2}+3h^{2}x+h^{3}\right]}{h}$$ Now the expression can be simplified to remove $h$ from the denominator. $$m=\lim_{h\rightarrow0}6x+3h-3x^{2}-3hx-h^{2}$$ Since $h$ is no longer in the denominator we can actually find the limit. $$m=6x-3x^{2}$$ Finally, plug in $A_{x}=\sqrt{3}+1$ to find the slope. $$m=6\left(\sqrt{3}+1\right)-3\cdot\left(\sqrt{3}+1\right)^{2}=-6.0 \tag{EQ 2}\label{EQ 2}$$ Of course, by the time we have found $m$ in equation $\eqref{EQ 2}$ we have also completed one of the basic lessons in differential calculus. Once we have the slope, the tangent line comes from the point slope form. $$y-A_{y}=m(x-A_{x})\Longrightarrow y=-6(x-\sqrt{3}-1)+2$$ $$y=-6x+6\sqrt{3}+8$$